﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }
        public Form3(int id, string Name, int age)
        {
            InitializeComponent();
            textBox1.Text = id.ToString();
            textBox2.Text = Name;
            textBox3.Text = age.ToString();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            var sql = string.Format("update Stsdents set Name='{0}',age='{1}' where id='{2}'", textBox2.Text, textBox3.Text,textBox1.Text);
            var res = DbHelper.AddOrEdiSave(sql);
            if (res == 1)
            {
                MessageBox.Show("更新成功", "提示");
            }



        }
    }
}
